package com.humngyang.com.hmy.study.springtest;

import com.humngyang.com.hmy.study.springtest.AppConfig;
import com.humngyang.com.hmy.study.springtest.BService;
import com.humngyang.com.hmy.study.springtest.textAop.L;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class test {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext(AppConfig.class);

        System.out.println(annotationConfigApplicationContext.getBean(BService.class));
//        L l = (L) annotationConfigApplicationContext.getBean("city");
//        l.query();


//        关闭默认的单例模式
//        AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext();
//        ac.register(AppConfig.class);
//
////        获取beanFactory然后将单例模式关闭
//        AbstractAutowireCapableBeanFactory AbstractAutowireCapableBeanFactory = (AbstractAutowireCapableBeanFactory) ac.getAutowireCapableBeanFactory();
//        AbstractAutowireCapableBeanFactory.setAllowCircularReferences(false);
//        ac.refresh();
//        L l2 = (L) annotationConfigApplicationContext.getBean("c");
//        l2.query();

    }





}
